package com.从排序数组中删除重复项;

public class Solution {

public int removeDuplicates(int[] nums) {
	int length = nums.length;
	int i=0;
	int k=0;
	while(i<length) {
		while(i+1<length&&(nums[i]==nums[i+1])) {
			k++;
			i++;
		}
		if(k>0) {
			for(int j=i;j<length;j++) {
				nums[j-k]=nums[j];
			}
			length=length-k;
			i=i-k;
			k=0;
		}
		i++;
	}
		return length;
        
    }



}
